// 进行路由判断
import React from 'react'
import axios from 'axios'
import loadable from '../util/loadable';
import Admin from '../components/admin/AdminHome'
import {withRouter,Route,Switch, Redirect } from 'react-router-dom'
const AdminDoc = loadable(() => import('../components/admin/AdminDoc'))
const ServerEdit = loadable(() => import('../components/admin/BraftEditors'))
const AdminCategory= loadable(() => import('../components/admin/AdminCategory'))
const DocEdit = loadable(()=>import('../components/admin/Editor/DocEditor'))
const AdminServer = loadable(() => import('../components/admin/AdminServer'))
const AdminMenber = loadable(() => import('../components/admin/AdminMenber'))
const NoFound = loadable(() => import('../components/404/NoFound'))
const AdminNews = loadable(() => import('../components/admin/adminNews/AdminNews'))
const AddNews = loadable(() => import('../components/admin/adminNews/AddNews'))
const UpdateNews = loadable(() => import('../components/admin/adminNews/UpdateNews'))
const code=1;
class AuthRoute extends React.Component {



    componentDidMount(){
        const publicList=['/admin'];
        const pathname=this.props.location.pathname;
       
    }
    render () {

        return (
            <Route path="/admin" render={()=>
                { return localStorage.token?<Admin>
                <Switch>
                    <Route path="/admin/menbers" exact component={AdminMenber} />
                    <Route path="/admin/server" exact component={AdminServer} />
                    <Route path="/admin/category" exact component={AdminCategory} />
                    <Route path='/admin/document' exact component={AdminDoc} />
                    <Route path='/admin/news' exact component={AdminNews} />
                    <Route path='/admin/addnews' exact component={AddNews} />
                    <Route path='/admin/updatenews/:id' exact component={UpdateNews} />
                    <Route path="/admin/serveredit/:data" exact component={ServerEdit} />
                    <Route path="/admin/docedit" exact component={DocEdit} />
                </Switch>
            </Admin>: <Route component={NoFound} path="*" />}
            } />
        )

    }

}

export default withRouter(AuthRoute);